package com.dongdongshop.serviec.brand;

import com.alibaba.dubbo.config.annotation.Service;
import com.dongdongshop.mapper.seller.TbItemMapper;
import com.dongdongshop.pojo.seller.TbItem;
import com.dongdongshop.pojo.seller.TbItemExample;
import com.dongdongshop.service.ItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

@Component
@Service
public class ItemServiceImpl implements ItemService {

    @Resource
    private TbItemMapper itemMapper;

    @Override
    public Long selectGoodsById(Long itemId) {
        return itemMapper.selectGoodsById(itemId);
    }

    @Override
    public TbItem getItemById(Long itemId) {
        return itemMapper.selectByPrimaryKey(itemId);
    }

    //前台详情展示规格查询
    @Override
    public List<TbItem> ListItemsByGoodsId(Long goodsId) {
        TbItemExample example=new TbItemExample();
        TbItemExample.Criteria criteria = example.createCriteria();
        criteria.andGoodsIdEqualTo(goodsId);
        return itemMapper.selectByExample(example);
    }
}
